from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/submit', methods=['POST'])
def submit_data():
    # 从请求中获取MAC和IP地址
    mac = request.form.get('mac')
    ip = request.form.get('ip')
    
    # 在此处进行您需要的处理，例如保存到数据库或其他操作
    print(f"Received MAC: {mac}, IP: {ip}")
    
    # 返回成功响应
    return jsonify({"message": "Data received successfully!"})

if __name__ == '__main__':
    # 运行Flask应用程序，监听所有IP地址的5000端口
    app.run(host='0.0.0.0', port=5000)
